package com.zty.user.designPattern.abstractFactoryPattern.easy;

import com.zty.user.designPattern.factoryPattern.easy.Circle;
import com.zty.user.designPattern.factoryPattern.easy.Rectangle;
import com.zty.user.designPattern.factoryPattern.easy.Shape;

/**
 * @Author ZTY
 * @Description 对所有的形状做一个统一管理
 * @Date 2:32 2023-12-15
 **/

public class ShapeFactory extends AbstractFactory {

    @Override
    public Color getColor(String color) {
        return null;
    }

    //  使用getShape方法获取形状类型的对象
    //  你告诉我你要一个什么类型，你别管是长什么样的，只需知道我会给你准确就行画出来
    @Override
    public Shape getShape(String shapeType) {
        if (shapeType == null) {
            return null;
        }
        if (shapeType.equalsIgnoreCase("CIRCLE")) {
            return new Circle();
        } else if (shapeType.equalsIgnoreCase("RECTANGLE")) {
            return new Rectangle();
        }
        return null;
    }

}
